<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>codemirror编辑器</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/js/layui/css/layui.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/ku.css">
    <script src="/js/layui/layui.js"></script>
</head>

<body>
    <div class="layui-layout ku-layout-admin">
        <div class="layui-header">
            <div class=" layui-clear">
                <div class="ku-menu-more layui-show-xs-inline-block   layui-hide-sm" lay-header-event="menuLeft">
                    <i class="layui-icon layui-icon-spread-left"></i>
                </div>
                <div class="layui-logo  ">
                    <a class=" layui-font-30 layui-font-white">
                        deloitte
                        <!--<img src="https://digitaltech-dev.deloitte.com.cn/img/logo.iPGv0ASH.png">-->
                    </a>
                </div>

                <ul class="layui-nav ku-menu" id="menu">
                    <!-- 移动端显示 -->
                    <li class="layui-nav-item "><a href="/">首页</a></li>
                    <li class="layui-nav-item ">
                        <a href="javascript:;">数字化审计工具</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;">数字化审计工具</a></dd>
                            <dd><a href="javascript:;">需求与建议</a></dd>
                            <dd><a href="javascript:;">联系人</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item  "><a href="javascript:;">Audit Pursuit</a></li>
                    <li class="layui-nav-item ">
                        <a href="javascript:;">GenAI</a>
                        <dl class="layui-nav-child">
                            <dd class="layui-this"><a href="javascript:;">用户使用提示</a></dd>
                            <dd><a href="javascript:;">审计应用案例</a></dd>
                            <dd><a href="javascript:;">创新提议</a></dd>
                        </dl>
                    </li>
                </ul>

            </div>
        </div>

        <div class="layui-body">
            <div class="layui-main">

                <blockquote class="layui-elem-quote layui-text">
                    JSON 格式化校验
                </blockquote>

                <div class="layui-card">
                    <div class="layui-card-body">
                        <link rel="stylesheet" href="/js/codemirror/codemirror.css">
                        <script src="/js/codemirror/codemirror.js"></script>
                        <script src="/js/codemirror/javascript.js"></script>
                        <textarea id="code" name="code">
                        {
                            "Data": {
                                "UserId": "1162b011-f2a3-4371-8d92-05055c535f4d",
                                "Account": "kwtang-c_Tang, Kai Wen",
                                "UserName": "Tang, Kai Wen",
                                "UserEmail": "kwtang-c@deloittecn.com.cn",
                                "Role": "Manager",
                                "AccessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiMGEyMDhiMTI1ZmFjNDY0N2EzNTQyNjcyMWVjNmZkYjgiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIxMTYyYjAxMS1mMmEzLTQzNzEtOGQ5Mi0wNTA1NWM1MzVmNGQiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiVGFuZywgS2FpIFdlbiIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6Ik1hbmFnZXIiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjBhMjA4YjEyNWZhYzQ2NDdhMzU0MjY3MjFlYzZmZGI4IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwOS8wOS9pZGVudGl0eS9jbGFpbXMvYWN0b3IiOiJrd3RhbmctY0BkZWxvaXR0ZWNuLmNvbS5jbiIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvZXhwaXJlZCI6IjIwMjUtMDItMTIgMTg6MTg6MjIuNTEyIiwiaWF0IjoxNzM5MjY5MTAyLCJuYmYiOjE3MzkyNjkxMDIsImV4cCI6MTczOTI3MDMwMiwiaXNzIjoiQ0FBVCIsImF1ZCI6IkNBQVQifQ.owt-sV7lvdxTSECYycy92PcyJbTSFXK-wFw4X7EpZfk",
                                "RefreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmIjoiZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5IiwiZSI6Im93dC1zVjdsdmR4VFNFQ1l5Y3k5MlBjeUpiVFNGWEstd0Z3NFg3RXBaZmsiLCJzIjo0MSwibCI6MTIsImsiOiJ5OHlNREExTHpBMUwiLCJpYXQiOjE3MzkyNjkxMDIsIm5iZiI6MTczOTI2OTEwMiwiZXhwIjoxNzM5MjcwOTAyLCJpc3MiOiJDQUFUIiwiYXVkIjoiQ0FBVCJ9.Dk6dP0mWNaGCQOWYZIYASgtswFBZFYWUFWty73rmheg"
                            },
                            "Total": 0,
                            "Code": 0,
                            "Message": "登录成功",
                            "Success": true
                        }

                    </textarea>

                        <script>

                            //var input = document.getElementById("select");
                            //function selectTheme() {
                            //    var theme = input.options[input.selectedIndex].textContent;
                            //    editor.setOption("theme", theme);
                            //    location.hash = "#" + theme;
                            //}
                            //var choice = (location.hash && location.hash.slice(1)) ||
                            //    (document.location.search &&
                            //        decodeURIComponent(document.location.search.slice(1)));
                            //if (choice) {
                            //    input.value = choice;
                            //    editor.setOption("theme", choice);
                            //}
                            //CodeMirror.on(window, "hashchange", function () {
                            //    var theme = location.hash.slice(1);
                            //    if (theme) { input.value = theme; selectTheme(); }
                            //});
                        </script>
                    </div>
                </div>
                <div class="layui-card">
                    <div class="layui-card-body">
                        <a id="btnDemo" class="layui-btn">获取内容</a>
                        <script>
                            var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
                                lineNumbers: true,
                                styleActiveLine: true,
                                matchBrackets: true
                            });


                            window.onload = function () {
                                document.getElementById("btnDemo").onclick = function () {
                                    try {
                                        var result = editor.getValue()// 获取内容
                                        if (result) {
                                            document.getElementById("result").className = "pass";
                                            document.getElementById("result").innerHTML = result;
                                        }
                                    } catch (e) {
                                        document.getElementById("result").innerHTML = e;
                                        document.getElementById("result").className = "fail";
                                    }
                                };
                            }
                        </script>
                    </div>
                </div>
                <div class="layui-card">
                    <div class="layui-card-header">结果</div>
                    <div class="layui-card-body">
                        <pre id="result"></pre>
                    </div>
                </div>
            </div>

            <div class="ku-footer">
                <div class="layui-main">
                    <p class="footer-statement">本站申明：本网站部分工具是站长整合网上已有工具、开源包等，并全部遵循原有协议发布，著作权归属原作者或是团队。</p>
                    <p class="footer-copyright">
                        Copyright © 2011-2021  All rights
                        reserved. &nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="https://beian.miit.gov.cn/" style="color: #CCC;" target="_blank">闽ICP备20009294号-1</a>&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=35021102001143" style="color: #CCC;" target="_blank">闽公网安备 35021102001143号</a>
                    </p>
                </div>
            </div>
        </div>

    </div>
    <script>
        //JS
        layui.use(['element', 'layer', 'util'], function () {
            var element = layui.element;
            var layer = layui.layer;
            var util = layui.util;
            var $ = layui.$;

            //头部事件
            util.event('lay-header-event', {
                menuLeft: function (othis) { // 左侧菜单事件
                    //layer.msg('展开左侧菜单的操作', { icon: 0 });
                    var menuHtml = $("#menu").html();
                    layer.open({
                        type: 1,
                        title: false,
                        closeBtn: false,
                        content: '<div class="layui-nav layui-nav-tree" style="width: auto;height: 100%;">' + menuHtml + '</div>',
                        area: ['50%', '100%'],
                        offset: 'lt', // 右上角
                        anim: 'slideRight', // 从右侧抽屉滑出
                        shadeClose: true,
                        scrollbar: true,
                        success: function () {
                            element.render('nav'); //重新对导航进行渲染。注：layui 2.1.6 版本新增
                        }
                    });
                }
            });
        });
    </script>
</body>

</html>